import axios from "axios";
import {useStore} from "../pinia/index.js";

axios.interceptors.request.use(
    (config) => {
        //携带token 令牌
        const store=useStore()
        config.headers.Lctoken = store.token
        return config;
    }, (error) => {
        return Promise.reject(error);
    }
);

const baseurl="http://39.105.15.85:8081/api/"

// post请求
const postFile = (url, file) => {
    const formData = new FormData();
    formData.append('file', file.file);
    // 移除了Content-Type设置，axios会自动处理
    return axios.post(baseurl + url, formData,)
        .then(res => res.data);
};
export {
    postFile
}
